From 284d96ea8080e7c1628ce554db7bdbe7815a803f Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Fri, 26 Sep 2025 04:42:47 +0200 Subject: [PATCH] slider: Use actor relative coordinates when dragging Stop working on absolute coordinates here, this is not necessary. Part-of: --- js/ui/slider.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/js/ui/slider.js b/js/ui/slider.js index ede76cca5..01bb7c8f8 100644 --- a/js/ui/slider.js +++ b/js/ui/slider.js @@ -87,7 +87,7 @@ export const Slider = GObject.registerClass({ // sure that no 'notify::value' signal is emitted before this one. this.emit('drag-begin'); - const coords = this._panGesture.get_centroid_abs(); + const coords = this._panGesture.get_centroid(); this._moveHandle(coords.x, coords.y); return Clutter.EVENT_STOP; } @@ -107,7 +107,7 @@ export const Slider = GObject.registerClass({ } _onPanUpdate() { - const coords = this._panGesture.get_centroid_abs(); + const coords = this._panGesture.get_centroid(); this._moveHandle(coords.x, coords.y); } @@ -161,13 +161,11 @@ export const Slider = GObject.registerClass({ return super.vfunc_key_press_event(event); } - _moveHandle(absX, _absY) { - let relX; - const [sliderX] = this.get_transformed_position(); + _moveHandle(x, _y) { const rtl = this.get_text_direction() === Clutter.TextDirection.RTL; const width = this._barLevelWidth; - relX = absX - sliderX; + let relX = x; if (rtl) relX = width - relX; -- 2.39.5